package org.yray.netty.lengthfield;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.LengthFieldPrepender;
import org.yray.netty.demo.NettyClientHandler;

public class ClientDemo {


    public static void main(String[] args) throws Exception {
        NettyLengthFieldClientHandler nettyLengthFieldClientHandler=new NettyLengthFieldClientHandler();
        TcpClient tcpClient=new TcpClient(nettyLengthFieldClientHandler);
        Thread t=new Thread(tcpClient);
        t.start();
        Thread.sleep(5000);
        for(int i=0;i<100;i++)
        {
            nettyLengthFieldClientHandler.sendMsg("new"+i);
            Thread.sleep(2000);
        }
        Thread.sleep(600000);

    }


}
